package br.unip.tcc.domotic.orm;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "dispositivo")
@Inheritance(strategy=InheritanceType.JOINED)
public class Device extends AbstractORM {
	
	private static final long serialVersionUID = 1L;
	
	private Integer deviceId;
	private String deviceName;
	private Short devicePositionX;
	private Short devicePositionY;
	private Room room;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "cod_dispositivo", unique = true, nullable = false)
	public Integer getDeviceId() {
		return deviceId;
	}
	
	public void setDeviceId(Integer deviceId) {
		this.deviceId = deviceId;
	}
	
	@Column(name = "nom_dispositivo", nullable = false)
	public String getDeviceName() {
		return deviceName;
	}
	
	public void setDeviceName(String deviceName) {
		this.deviceName = deviceName;
	}
	
	@Column(name = "pos_x", nullable = false)
	public Short getDevicePositionX() {
		return devicePositionX;
	}
	
	public void setDevicePositionX(Short devicePositionX) {
		this.devicePositionX = devicePositionX;
	}
	
	@Column(name = "pos_y", nullable = false)
	public Short getDevicePositionY() {
		return devicePositionY;
	}
	
	public void setDevicePositionY(Short devicePositionY) {
		this.devicePositionY = devicePositionY;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cod_comodo", nullable = false)
	public Room getRoom() {
		return room;
	}
	
	public void setRoom(Room room) {
		this.room = room;
	}
	
}
